/* reverses a series of numbers using a variable - length array */

#include <stdio.h>

int main(void)
{
    int i, n;

    printf("How many numbers do you want to reverse?");
    scanf("%d", &n);

    int a[n]; /* c99 only - length of array depends on n */

    printf("enter %d numbers:",n);

    for(i=0;i<n;i++)
        scanf("%d", &a[i]);
    
    printf("in reverse order:");
    for(i=n-1;i>=0;i--)
        printf(" %d", a[i]);
    
    printf("\n");

    return 0;

}